/*
 * EnigmaGM - A feature rich guild management system.
 * Copyright (C) 2007 ajiaojr.
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */
package org.ajiaojr.enigmagm.client.service;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

import java.util.List;

/**
 * Service for accessing events from underlying storages.
 * 
 * @see org.ajiaojr.enigmagm.client.data.Event
 * @author ajiaojr
 */
public interface EventService extends RemoteService {
  /**
   * Utility class for simplifying access to the instance of async service.
   */
  public static class Util {
    private static EventServiceAsync instance;

    public static EventServiceAsync getInstance() {
      if (instance == null) {
        instance = (EventServiceAsync) GWT.create(EventService.class);
        ServiceDefTarget target = (ServiceDefTarget) instance;
        target.setServiceEntryPoint(GWT.getModuleBaseURL() + "/EventService");
      }
      return instance;
    }
  }

  /**
   * Finds attended events for a particular character.
   * 
   * @param characterID
   *          ID that uniquely identifies the character.
   * @param firstResult
   *          Index of the first result.
   * @param maxResults
   *          Maximum number of results the collection should contain.
   * @return A list containing events that fits the criteria.
   * @throws DataAccessException
   *           If any error should occur during the process.
   * @gwt.typeArgs <org.ajiaojr.enigmagm.client.data.Event>
   */
  public List findAttendedEvents(int characterID, int firstResult,
      int maxResults) throws DataAccessException;

  /**
   * @param raidID
   * @param firstResult
   * @param maxResults
   * @return
   * @throws DataAccessException
   * @gwt.typeArgs <org.ajiaojr.enigmagm.client.data.Event>
   */
  public List findByRaidID(int raidID, int firstResult, int maxResults)
      throws DataAccessException;
}
